package GUI;


import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.SpinnerListModel;
import javax.swing.SpringLayout;
import javax.swing.SwingUtilities;
import java.awt.Component;
import java.awt.Font;
import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
import java.util.Vector;
import javax.swing.JCheckBox;
import javax.swing.JTextPane;
import javax.swing.JToggleButton;
import DataObjects.ConstantObjects;
import DataObjects.User;
import Messages.MessageAddNewEmployee;
import Messages.MessageCheckUsername;
import Messages.MessageCheckUsernameReply;
import Messages.MessageSavingReply;
import Messages.MessageShowEmployeeIDReply;
import Messages.MessageShowIDEmployee;
import Messages.MessageUpdateEmployee;
import net.sourceforge.jdatepicker.JDateComponentFactory;
import net.sourceforge.jdatepicker.JDatePicker;
import net.sourceforge.jdatepicker.impl.JDatePickerImpl;
import java.awt.Checkbox;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.BorderLayout;
import javax.swing.BoxLayout;
import com.toedter.calendar.JCalendar;
import com.toedter.calendar.JDateChooser;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.border.MatteBorder;
import javax.swing.JLayeredPane;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import javax.swing.border.TitledBorder;
import javax.swing.UIManager;
import javax.swing.border.BevelBorder;

public class PfUpdate_employee extends JPanel {
	
	private MainMenu mainMenu;
	private User employee;
	private Vector<Vector> days;
	
	private JDatePickerImpl datePicker_birthday;
	private JDatePickerImpl datePicker_hireDate;
	private JDateChooser chooser;

	private VKTextField textField_city;
	private VKTextField textField_street;
	private VKTextField textField_house;
	private VKTextField textField_phoneNo;
	private VKTextField textField_email;
	private VKTextField textField_username;
	private VKTextField textField_password;
	private VKTextField textField_nameBank;
	private VKTextField textField_numBranch;
	private VKTextField textField_numAccount;
	private VKTextField textField_name;
	private VKTextField textField_surName;
	private VKTextField textField_id;
	private VKTextField textField_id_number;      //teudat zehut 
	
	private JCheckBox alef;
	private JCheckBox bet;
	private JCheckBox gimel;
	private JCheckBox dalet;
	private JCheckBox hey;
	private JCheckBox vav;
	private JCheckBox shabat;
	
	private  JComboBox rolesCB;
	private JComboBox priorityCB;
	private JComboBox statusCB;
	
	private JSpinner alefFrom;
	private JSpinner betFrom;
	private JSpinner gimelFrom;
	private JSpinner daletFrom;
	private JSpinner heyFrom;
	private JSpinner vavFrom;
	private JSpinner shabatFrom;
	private JSpinner alefTo;
	private JSpinner betTo;
	private JSpinner gimelTo;
	private JSpinner daletTo;
	private JSpinner heyTo;
	private JSpinner vavTo;
	private JSpinner shabatTo;
	
	private JLabel alefFromlbl;
	private JLabel betFromlbl;
	private JLabel gimelFromlbl;
	private JLabel daletFromlbl;
	private JLabel heyFromlbl;
	private JLabel vavFromlbl;
	private JLabel shabatFromlbl;
	private JLabel alefTolbl;
	private JLabel betTolbl;
	private JLabel gimelTolbl;
	private JLabel daletTolbl;
	private JLabel heyTolbl;
	private JLabel vavTolbl;
	private JLabel shabatTolbl;

	private JPanel top_panel;
	private JPanel lower_panel;
	private JPanel info_panel_right;
	private JPanel info_panel_left;
	private JPanel buttons_panel;
	private JPanel check_panel;
	private JPanel work_week_panel;
	private JPanel check_buttons_panel;
	
	

	public PfUpdate_employee(MainMenu mm,User emp)
	{
		super();		
		this.mainMenu=mm;
		this.employee=emp;
		this.days=emp.getWeekHours();
		setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
		initialize();
	}
	
		
		
	
	
		 
	public void initialize()
	{
		top_panel=new JPanel();
		top_panel.setBackground(new Color(255, 248, 220));
		top_panel.setBorder(new TitledBorder(null, "\u05E4\u05E8\u05D8\u05D9 \u05D4\u05E2\u05D5\u05D1\u05D3", TitledBorder.CENTER, TitledBorder.TOP, null, null));
		top_panel.setLayout(new BoxLayout(top_panel, BoxLayout.X_AXIS));
		top_panel.add(get_info_panel_left());
		top_panel.add(get_info_panel_right());
		lower_panel=new JPanel();
		lower_panel.setLayout(new BoxLayout(lower_panel, BoxLayout.X_AXIS));
		lower_panel.add(get_work_week_panel());
		lower_panel.add(get_check_buttons_panel());
		
		this.add(top_panel);
		this.add(lower_panel);

		
	}	
	
	
	
	private JPanel get_info_panel_right()
	{
		info_panel_right=new JPanel();
		info_panel_right.setBackground(new Color(255, 250, 205));
		info_panel_right.setLayout(new SpringLayout());
		
		textField_id=new VKTextField(mainMenu);
		textField_id.setHorizontalAlignment(JTextField.RIGHT);
		textField_id.setColumns(10);
		textField_id.setText(Integer.toString(employee.getEid()));
		textField_id.setEditable(false);
		JLabel eid = new JLabel("מספר עובד :", JLabel.TRAILING);
		eid.setLabelFor(textField_id);
		info_panel_right.add(textField_id);
		info_panel_right.add(eid);
		
		textField_name = new VKTextField(employee.getName(),mainMenu);
		textField_name.setHorizontalAlignment(JTextField.RIGHT);
		textField_name.setColumns(10);		
		JLabel name = new JLabel("שם פרטי (בעברית) :", JLabel.TRAILING);
		name.setLabelFor(textField_name);	
		info_panel_right.add(textField_name);
		info_panel_right.add(name);
		
		
		
		textField_surName = new VKTextField(employee.getLastName(),mainMenu);
		textField_surName.setHorizontalAlignment(JTextField.RIGHT);
		textField_surName.setColumns(10);
		JLabel lastName = new JLabel("שם משפחה (בעברית) :", JLabel.TRAILING);
		lastName.setLabelFor(textField_surName);
		info_panel_right.add(textField_surName);
		info_panel_right.add(lastName);
		
		textField_id_number = new VKTextField(employee.getIdNumber(),mainMenu);
		textField_id_number.setHorizontalAlignment(JTextField.RIGHT);
		textField_id_number.setColumns(10);
		JLabel id = new JLabel("מס' תעודת זהות (כולל ס. ביקורת) :", JLabel.TRAILING);
		id.setLabelFor(textField_id_number);
		info_panel_right.add(textField_id_number);
		info_panel_right.add(id);

		 datePicker_birthday = (JDatePickerImpl) JDateComponentFactory.createJDatePicker();
		 datePicker_birthday.getModel().setSelected(true);
		 String bdate=employee.getBirthdayDate().toString();
		 String byear=(String) bdate.subSequence(0, 4);
		 String bmonth=(String) bdate.subSequence(5, 7);
		 String bday=(String) bdate.subSequence(8, 10);
		 datePicker_birthday.getModel().setDate(Integer.parseInt(byear), Integer.parseInt(bmonth)-1, Integer.parseInt(bday));
		 JLabel birthday = new JLabel("תאריך לידה  :", JLabel.TRAILING);
		 birthday.setLabelFor(datePicker_birthday);
         info_panel_right.add(datePicker_birthday);
	     info_panel_right.add(birthday);
	     
		textField_city = new VKTextField(employee.getCity(),mainMenu);
		textField_city.setHorizontalAlignment(JTextField.RIGHT);
		textField_city.setColumns(10);
		JLabel labelCity = new JLabel("עיר (בעברית) :", JLabel.TRAILING);
		labelCity.setLabelFor(textField_city);
		info_panel_right.add(textField_city);
		info_panel_right.add(labelCity);
	   	
		textField_street = new VKTextField(employee.getStreet(),mainMenu);
		textField_street.setHorizontalAlignment(JTextField.RIGHT);
		textField_street.setColumns(10);
		JLabel label_1 = new JLabel("רחוב (בעברית) :", JLabel.TRAILING);
		label_1.setLabelFor(textField_street);
		info_panel_right.add(textField_street);
		info_panel_right.add(label_1);	
	   
		textField_house = new VKTextField(employee.getHouse(),mainMenu);
		textField_house.setHorizontalAlignment(JTextField.RIGHT);
		textField_house.setColumns(10);
		JLabel label_2 = new JLabel("מס' בית :", JLabel.TRAILING);
		label_2.setLabelFor(textField_house);	
		info_panel_right.add(textField_house);
		info_panel_right.add(label_2);

		textField_phoneNo = new VKTextField(employee.getPhoneNo(),mainMenu);
		textField_phoneNo.setHorizontalAlignment(JTextField.RIGHT);
		textField_phoneNo.setColumns(10);
		JLabel label_3 = new JLabel("מס' טלפון :", JLabel.TRAILING);
		label_3.setLabelFor(textField_phoneNo);
		info_panel_right.add(textField_phoneNo);
		info_panel_right.add(label_3);
	
		textField_email = new VKTextField(employee.getEmail(),mainMenu);
		textField_email.setHorizontalAlignment(JTextField.RIGHT);
		textField_email.setColumns(10);
		JLabel lblEmail = new JLabel("דואר אלקטרוני :", JLabel.TRAILING);
		lblEmail.setLabelFor(textField_email);
		info_panel_right.add(textField_email);
		info_panel_right.add(lblEmail);
		
		SpringUtilities.makeCompactGrid(info_panel_right, 10, 2, //rows, cols
			      6, 6, //initX, initY
			        50, 6); //xPad, yPad
		
		return info_panel_right;
	}
	
	
	private JPanel get_info_panel_left()
	   {		
			info_panel_left=new JPanel();
			info_panel_left.setBackground(new Color(255, 250, 205));
			info_panel_left.setLayout(new SpringLayout());
			
			 rolesCB=new JComboBox(new ConstantObjects().getRoles());			 
			 JLabel label_4 = new JLabel("תפקיד :", JLabel.TRAILING);
			 label_4.setLabelFor(rolesCB);
			 rolesCB.setSelectedItem(employee.getRole());
			 info_panel_left.add(rolesCB);	
			 info_panel_left.add(label_4);
							
				datePicker_hireDate = (JDatePickerImpl) JDateComponentFactory.createJDatePicker();
			    datePicker_hireDate.getModel().setSelected(true);
			    String hdate=employee.getHireDayDate().toString();
				 String hyear=(String) hdate.subSequence(0, 4);
				 String hmonth=(String) hdate.subSequence(5, 7);
				 String hday=(String) hdate.subSequence(8, 10);
				 datePicker_hireDate.getModel().setDate(Integer.parseInt(hyear), Integer.parseInt(hmonth)-1, Integer.parseInt(hday));
				JLabel hireDate = new JLabel("תאריך תחילת העבודה  :", JLabel.TRAILING);
				hireDate.setLabelFor(datePicker_hireDate);
		        info_panel_left.add(datePicker_hireDate);
			    info_panel_left.add(hireDate);
			
			 priorityCB=new JComboBox(new ConstantObjects().getPriority());
			 priorityCB.setSelectedItem(Integer.toString(employee.getPermission()));
			 
			priorityCB.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					JComboBox prBox = (JComboBox)e.getSource();
				    String selectedPriority = (String)prBox.getSelectedItem();
				    int priority=Integer.parseInt(selectedPriority);
				    if(priority>0)
				    {
				    	
				    	textField_password.setEditable(true);
				    
				    }
				    else                 // priority==0
				    {
				    	
				    	textField_username.setEditable(false);
				    	textField_password.setEditable(false);
				    }
				}
			});
			
			JLabel label_5 = new JLabel("רמת הרשאה :", JLabel.TRAILING);
			label_5.setLabelFor(priorityCB);		
			info_panel_left.add(priorityCB);
			info_panel_left.add(label_5);
			
			textField_username = new VKTextField(mainMenu);
			textField_username.setHorizontalAlignment(JTextField.RIGHT);
			textField_username.setColumns(10);
			textField_username.setEditable(false);		
			JLabel label_6 = new JLabel("שם משתמש :", JLabel.TRAILING);
			label_6.setLabelFor(textField_username);	
			info_panel_left.add(textField_username);
			info_panel_left.add(label_6);
			
			textField_password = new VKTextField(mainMenu);
			textField_password.setHorizontalAlignment(JTextField.RIGHT);
			textField_password.setColumns(10);
			textField_password.setEditable(false);		
			JLabel label_7 = new JLabel("סיסמה :", JLabel.TRAILING);
			label_7.setLabelFor(textField_password);		
			info_panel_left.add(textField_password);
			info_panel_left.add(label_7);
			
			if (employee.getPermission()>0)
			 {
				   
			    	textField_username.setText(employee.getUsername());
			    	textField_password.setEditable(true);
			    	textField_password.setText(employee.getpassword());
			 }
			
			textField_nameBank = new VKTextField(employee.getNameBank(),mainMenu);
			textField_nameBank.setHorizontalAlignment(JTextField.RIGHT);
			textField_nameBank.setColumns(10);
			JLabel label_8 = new JLabel("שם הבנק (בעברית) :", JLabel.TRAILING);
			label_8.setLabelFor(textField_nameBank);
			info_panel_left.add(textField_nameBank);
			info_panel_left.add(label_8);
			
			textField_numBranch = new VKTextField(employee.getNumBranch(),mainMenu);
			textField_numBranch.setHorizontalAlignment(JTextField.RIGHT);
			textField_numBranch.setColumns(10);
			JLabel label_9 = new JLabel("מספר סניף :", JLabel.TRAILING);
			label_9.setLabelFor(textField_numBranch);		
			info_panel_left.add(textField_numBranch);
			info_panel_left.add(label_9);
			
			textField_numAccount = new VKTextField(employee.getNumAccount(),mainMenu);
			textField_numAccount.setHorizontalAlignment(JTextField.RIGHT);
			textField_numAccount.setColumns(10);		
			JLabel label_10 = new JLabel("מספר חשבון :", JLabel.TRAILING);
			label_10.setLabelFor(textField_numAccount);		
			info_panel_left.add(textField_numAccount);
			info_panel_left.add(label_10);
			
			
			statusCB=new JComboBox(new ConstantObjects().getEmpStatus());			 
			 JLabel label_status = new JLabel("מצב העובד :", JLabel.TRAILING);
			 label_status.setLabelFor(statusCB);
			 statusCB.setSelectedItem(employee.getStatus());
			 info_panel_left.add(statusCB);	
			 info_panel_left.add(label_status);
				
			SpringUtilities.makeCompactGrid(info_panel_left, 9, 2, //rows, cols
				      6, 6, //initX, initY
				      50, 6); //xPad, yPad
			return info_panel_left;
	   }
	
	
	
	private JPanel get_work_week_panel()
	{
		 work_week_panel = new JPanel();		
		 work_week_panel.setBorder(new TitledBorder(null, "\u05D9\u05DE\u05D9 \u05E2\u05D1\u05D5\u05D3\u05D4", TitledBorder.CENTER, TitledBorder.TOP, null, null));
		 work_week_panel.setLayout(new SpringLayout());
		 work_week_panel.setBackground(new Color(255, 255, 240));
		 
		 alef=new JCheckBox("א");
		 alefFrom=createHoursSpinner ();
		 alefTo=createHoursSpinner ();
		 alefFromlbl=new JLabel("משעה :");
		 alefTolbl=new JLabel ("עד שעה :");
		 alefFromlbl.setLabelFor(alefFrom);
		 alefTolbl.setLabelFor(alefTo);
		 work_week_panel.add(alefTo);
		 work_week_panel.add(alefTolbl);
		 work_week_panel.add(alefFrom);
		 work_week_panel.add(alefFromlbl);		 
		 work_week_panel.add(alef);
		 
		 alef.addActionListener(new ActionListener() {
			  public void actionPerformed(ActionEvent evt) {
				  alefFrom.setVisible(alef.isSelected());
				  alefTo.setVisible(alef.isSelected());
				  alefFromlbl.setVisible(alef.isSelected());
				  alefTolbl.setVisible(alef.isSelected());
			  }
			});
		 
		
	     bet=new JCheckBox("ב");
	     betFrom=createHoursSpinner ();
		 betTo=createHoursSpinner ();
		 betFromlbl=new JLabel("משעה :");
		 betTolbl=new JLabel ("עד שעה :");
		 betFromlbl.setLabelFor(betFrom);
		 betTolbl.setLabelFor(betTo);
		 work_week_panel.add(betTo);
		 work_week_panel.add(betTolbl);
		 work_week_panel.add(betFrom);
		 work_week_panel.add(betFromlbl);		 
		 work_week_panel.add(bet);
		 bet.addActionListener(new ActionListener() {
			  public void actionPerformed(ActionEvent evt) {
				  betFrom.setVisible(bet.isSelected());
				  betTo.setVisible(bet.isSelected());
				  betFromlbl.setVisible(bet.isSelected());
				  betTolbl.setVisible(bet.isSelected());
			  }
			});
		 
	     gimel=new JCheckBox("ג");
	     gimelFrom=createHoursSpinner ();
		 gimelTo=createHoursSpinner ();
		 gimelFromlbl=new JLabel("משעה :");
		 gimelTolbl=new JLabel ("עד שעה :");
		 gimelFromlbl.setLabelFor(gimelFrom);
		 gimelTolbl.setLabelFor(gimelTo);
		 work_week_panel.add(gimelTo);
		 work_week_panel.add(gimelTolbl);
		 work_week_panel.add(gimelFrom);
		 work_week_panel.add(gimelFromlbl);		 
		 work_week_panel.add(gimel);
		 gimel.addActionListener(new ActionListener() {
			  public void actionPerformed(ActionEvent evt) {
				  gimelFrom.setVisible(gimel.isSelected());
				  gimelTo.setVisible(gimel.isSelected());
				  gimelFromlbl.setVisible(gimel.isSelected());
				  gimelTolbl.setVisible(gimel.isSelected());
			  }
			});
		 
	     dalet=new JCheckBox("ד");
	     daletFrom=createHoursSpinner ();
		 daletTo=createHoursSpinner ();
		 daletFromlbl=new JLabel("משעה :");
		 daletTolbl=new JLabel ("עד שעה :");
		 daletFromlbl.setLabelFor(daletFrom);
		 daletTolbl.setLabelFor(daletTo);
		 work_week_panel.add(daletTo);
		 work_week_panel.add(daletTolbl);
		 work_week_panel.add(daletFrom);
		 work_week_panel.add(daletFromlbl);		 
		 work_week_panel.add(dalet);
		 dalet.addActionListener(new ActionListener() {
			  public void actionPerformed(ActionEvent evt) {
				  daletFrom.setVisible(dalet.isSelected());
				  daletTo.setVisible(dalet.isSelected());
				  daletFromlbl.setVisible(dalet.isSelected());
				  daletTolbl.setVisible(dalet.isSelected());
			  }
			});
		 
	     hey=new JCheckBox("ה");
	     heyFrom=createHoursSpinner ();
		 heyTo=createHoursSpinner ();
		 heyFromlbl=new JLabel("משעה :");
		 heyTolbl=new JLabel ("עד שעה :");
		 heyFromlbl.setLabelFor(heyFrom);
		 heyTolbl.setLabelFor(heyTo);
		 work_week_panel.add(heyTo);
		 work_week_panel.add(heyTolbl);
		 work_week_panel.add(heyFrom);
		 work_week_panel.add(heyFromlbl);		 
		 work_week_panel.add(hey);
		 hey.addActionListener(new ActionListener() {
			  public void actionPerformed(ActionEvent evt) {
				  heyFrom.setVisible(hey.isSelected());
				  heyTo.setVisible(hey.isSelected());
				  heyFromlbl.setVisible(hey.isSelected());
				  heyTolbl.setVisible(hey.isSelected());
			  }
			});
		 
	     vav=new JCheckBox("ו");
	     vavFrom=createHoursSpinner ();
		 vavTo=createHoursSpinner ();
		 vavFromlbl=new JLabel("משעה :");
		 vavTolbl=new JLabel ("עד שעה :");
		 vavFromlbl.setLabelFor(vavFrom);
	   	 vavTolbl.setLabelFor(vavTo);
		 work_week_panel.add(vavTo);
		 work_week_panel.add(vavTolbl);
		 work_week_panel.add(vavFrom);
		 work_week_panel.add(vavFromlbl);		 
		 work_week_panel.add(vav);
		 vav.addActionListener(new ActionListener() {
			  public void actionPerformed(ActionEvent evt) {
				  vavFrom.setVisible(vav.isSelected());
				  vavTo.setVisible(vav.isSelected());
				  vavFromlbl.setVisible(vav.isSelected());
				  vavTolbl.setVisible(vav.isSelected());
			  }
			});
		 
	     shabat=new JCheckBox("ש");
	     shabatFrom=createHoursSpinner ();
		 shabatTo=createHoursSpinner ();
		 shabatFromlbl=new JLabel("משעה :");
		 shabatTolbl=new JLabel ("עד שעה :");
		 shabatFromlbl.setLabelFor(shabatFrom);
	   	 shabatTolbl.setLabelFor(shabatTo);
		 work_week_panel.add(shabatTo);
		 work_week_panel.add(shabatTolbl);
		 work_week_panel.add(shabatFrom);
		 work_week_panel.add(shabatFromlbl);		 
		 work_week_panel.add(shabat);
		 shabat.addActionListener(new ActionListener() {
			  public void actionPerformed(ActionEvent evt) {
				  shabatFrom.setVisible(shabat.isSelected());
				  shabatTo.setVisible(shabat.isSelected());
				  shabatFromlbl.setVisible(shabat.isSelected());
				  shabatTolbl.setVisible(shabat.isSelected());
			  }
			});
		 
		 set_Visible_False_For_Working_Panel();
		 
		 
		 //
		 //initialize work week hours
		 //
		 for(int i=0;i<days.size();i++)
		 {
			 Vector<String> day=days.get(i);
			 
			 if (day.get(0).equals("א"))
			 {
				 alef.setSelected(true);
				 alefFrom.setVisible(true);
				 alefFromlbl.setVisible(true);
				 alefTo.setVisible(true);
				 alefTolbl.setVisible(true);
				 alefFrom.getModel().setValue(day.get(1)+".00");
				 alefTo.getModel().setValue(day.get(2)+".00");
			 }
			 
			 if (day.get(0).equals("ב"))
			 {
				 bet.setSelected(true);
				 betFrom.setVisible(true);
				 betFromlbl.setVisible(true);
				 betTo.setVisible(true);
				 betTolbl.setVisible(true);
				 betFrom.getModel().setValue(day.get(1)+".00");
				 betTo.getModel().setValue(day.get(2)+".00");
			 }
			 
			 
			 if (day.get(0).equals("ג"))
			 {
				 gimel.setSelected(true);
				 gimelFrom.setVisible(true);
				 gimelFromlbl.setVisible(true);
				 gimelTo.setVisible(true);
				 gimelTolbl.setVisible(true);
				 gimelFrom.getModel().setValue(day.get(1)+".00");
				 gimelTo.getModel().setValue(day.get(2)+".00");
			 }
			 
			 
			 if (day.get(0).equals("ד"))
			 {
				 dalet.setSelected(true);
				 daletFrom.setVisible(true);
				 daletFromlbl.setVisible(true);
				 daletTo.setVisible(true);
				 daletTolbl.setVisible(true);
				 daletFrom.getModel().setValue(day.get(1)+".00");
				 daletTo.getModel().setValue(day.get(2)+".00");
			 }
			 
			 
			 if (day.get(0).equals("ה"))
			 {
				 hey.setSelected(true);
				 heyFrom.setVisible(true);
				 heyFromlbl.setVisible(true);
				 heyTo.setVisible(true);
				 heyTolbl.setVisible(true);
				 heyFrom.getModel().setValue(day.get(1)+".00");
				 heyTo.getModel().setValue(day.get(2)+".00");
			 }
			 
			 
			 if (day.get(0).equals("ו"))
			 {
				 vav.setSelected(true);
				 vavFrom.setVisible(true);
				 vavFromlbl.setVisible(true);
				 vavTo.setVisible(true);
				 vavTolbl.setVisible(true);
				 vavFrom.getModel().setValue(day.get(1)+".00");
				 vavTo.getModel().setValue(day.get(2)+".00");
			 }
			 
			 
			 if (day.get(0).equals("שבת"))
			 {
				 shabat.setSelected(true);
				 shabatFrom.setVisible(true);
				 shabatFromlbl.setVisible(true);
				 shabatTo.setVisible(true);
				 shabatTolbl.setVisible(true);
				 shabatFrom.getModel().setValue(day.get(1)+".00");
				 shabatTo.getModel().setValue(day.get(2)+".00");
			 }
			 
			 }//for(int i=0;i<days.size();i++)
	     
	     SpringUtilities.makeCompactGrid(work_week_panel, 7, 5, //rows, cols
			      6, 6, //initX, initY
			        50, 6); //xPad, yPad
	 return work_week_panel;    
	}
	
	private JPanel get_check_buttons_panel()
	{
		check_buttons_panel=new JPanel ();
		check_buttons_panel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u05D1\u05D3\u05D9\u05E7\u05EA \u05EA\u05E7\u05D9\u05E0\u05D5\u05EA ", TitledBorder.CENTER, TitledBorder.TOP, null, new Color(0, 0, 0)));
		check_buttons_panel.setLayout(new BoxLayout(check_buttons_panel, BoxLayout.Y_AXIS));
		check_buttons_panel.setBackground(new Color(245, 245, 245));
		check_buttons_panel.add(get_buttons_panel());
		check_buttons_panel.add(Box.createVerticalGlue());
		check_buttons_panel.add(get_check_panel());
		check_buttons_panel.add(Box.createVerticalGlue());
		return check_buttons_panel;
	}
	
	//panel for saving status
	// and error messages
	private JPanel get_check_panel()
	{
		check_panel=new JPanel();
		check_panel.setBackground(new Color(245, 245, 245));
        check_panel.setLayout(new BoxLayout(check_panel, BoxLayout.Y_AXIS));
		return check_panel;
	}
	
	private JPanel get_buttons_panel()
	{
		buttons_panel=new JPanel();
		buttons_panel.setLayout(new BoxLayout(buttons_panel, BoxLayout.X_AXIS));
		buttons_panel.setBackground(Color.YELLOW);

		buttons_panel.add(get_btnClear());
		buttons_panel.add(get_btnSave());
		return buttons_panel;
		
	}
	
	
	private JButton get_btnClear()
	{
		JButton btnClear=new JButton("נקה מסך");
		return btnClear;
	}
	
	private JButton get_btnSave()
	{
		
		JButton btnSave = new JButton("שמור");
		btnSave.setBounds(203, 422, 89, 23);
		btnSave.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent e) {
				check_panel.removeAll();
				
				Vector<String> checkingResult=inputCheck();
				Vector<Vector> weekHours=new Vector<Vector>();
				int size=checkingResult.size();
				if(size==0)
				{
					JLabel goodLbl=new JLabel("כל הנתונים תקינים");
					goodLbl.setFont(new Font("Tahoma", Font.BOLD, 13));
					goodLbl.setForeground(Color.blue);
					check_panel.add(goodLbl);	
					
					User employee=new User();
					
					employee.setName(textField_name.getText()) ;
					employee.setLastName(textField_surName.getText());
					employee.setEid(Integer.parseInt(textField_id.getText()));
					employee.setIdNumber(textField_id_number.getText()) ;
					
					int hireDate_year=datePicker_hireDate.getModel().getYear();
					int hireDate_month=datePicker_hireDate.getModel().getMonth()+1;
					int hireDate_day=datePicker_hireDate.getModel().getDay();
					
					int birthday_year=datePicker_birthday.getModel().getYear();
					int birthday_month=datePicker_birthday.getModel().getMonth()+1;
					int birthday_day=datePicker_birthday.getModel().getDay();
					
					employee.setHireDate(Integer.toString(hireDate_year)+"-"+Integer.toString(hireDate_month)+"-"+Integer.toString(hireDate_day));
					employee.setBirthday(Integer.toString(birthday_year)+"-"+Integer.toString(birthday_month)+"-"+Integer.toString(birthday_day));
							
					employee.setCity(textField_city.getText()) ;				
					employee.setStreet(textField_street.getText()) ;
					employee.setHouse(textField_house.getText()) ;
					employee.setPhoneNo(textField_phoneNo.getText()) ;
					employee.setEmail(textField_email.getText()) ;
					employee.setRole((String)rolesCB.getSelectedItem()) ;
					employee.setPassword(textField_password.getText()) ;
					employee.setNameBank(textField_nameBank.getText()) ;
					employee.setNumBranch(textField_numBranch.getText()) ;
					employee.setNumAccount(textField_numAccount.getText()) ;
					employee.setPermission(Integer.parseInt((String)priorityCB.getSelectedItem())) ;
					employee.setUsername(textField_username.getText());
					employee.setStatus((String)statusCB.getSelectedItem());
					
					if (alef.isSelected())
					{
						
						String alefValueFrom = (String)alefFrom.getModel().getValue();
						String alefValueFrom1=alefValueFrom.substring(0,2);
						String alefValueFrom2;			
						if(alefValueFrom1.endsWith("."))
							alefValueFrom2=alefValueFrom.substring(0,1);
						else alefValueFrom2=alefValueFrom1;
		
						String alefValueTo = (String)alefTo.getModel().getValue();
						String alefValueTo1=alefValueTo.substring(0,2);
						String alefValueTo2;			
						if(alefValueTo1.endsWith("."))
							alefValueTo2=alefValueTo.substring(0,1);
						else alefValueTo2=alefValueTo1;

						Vector<String> alefHours=new Vector<String>();
						alefHours.add("א");
						alefHours.add(alefValueFrom2);
						alefHours.add(alefValueTo2);
						weekHours.add(alefHours);
										
					}
					
				
					if (bet.isSelected())
					{
						String betValueFrom = (String)betFrom.getModel().getValue();
						String betValueFrom1=betValueFrom.substring(0,2);
						String betValueFrom2;			
						if(betValueFrom1.endsWith("."))
							betValueFrom2=betValueFrom.substring(0,1);
						else betValueFrom2=betValueFrom1;

						String betValueTo = (String)betTo.getModel().getValue();
						String betValueTo1=betValueTo.substring(0,2);
						String betValueTo2;			
						if(betValueTo1.endsWith("."))
							betValueTo2=betValueTo.substring(0,1);
						else betValueTo2=betValueTo1;
						
						Vector<String> betHours=new Vector<String>();
						betHours.add("ב");
						betHours.add(betValueFrom2);
						betHours.add(betValueTo2);
						weekHours.add(betHours);
						
				
					}
					
					if (gimel.isSelected())
					{
						String gimelValueFrom = (String)gimelFrom.getModel().getValue();
						String gimelValueFrom1=gimelValueFrom.substring(0,2);
						String gimelValueFrom2;			
						if(gimelValueFrom1.endsWith("."))
							gimelValueFrom2=gimelValueFrom.substring(0,1);
						else gimelValueFrom2=gimelValueFrom1;

						String gimelValueTo = (String)gimelTo.getModel().getValue();
						String gimelValueTo1=gimelValueTo.substring(0,2);
						String gimelValueTo2;			
						if(gimelValueTo1.endsWith("."))
							gimelValueTo2=gimelValueTo.substring(0,1);
						else gimelValueTo2=gimelValueTo1;
						
						Vector<String> gimelHours=new Vector<String>();
						gimelHours.add("ג");
						gimelHours.add(gimelValueFrom2);
						gimelHours.add(gimelValueTo2);
						weekHours.add(gimelHours);
					}
					
					
					if (dalet.isSelected())
					{
						String daletValueFrom = (String)daletFrom.getModel().getValue();
						String daletValueFrom1=daletValueFrom.substring(0,2);
						String daletValueFrom2;			
						if(daletValueFrom1.endsWith("."))
							daletValueFrom2=daletValueFrom.substring(0,1);
						else daletValueFrom2=daletValueFrom1;

						String daletValueTo = (String)daletTo.getModel().getValue();
						String daletValueTo1=daletValueTo.substring(0,2);
						String daletValueTo2;			
						if(daletValueTo1.endsWith("."))
							daletValueTo2=daletValueTo.substring(0,1);
						else daletValueTo2=daletValueTo1;
						
						Vector<String> daletHours=new Vector<String>();
						daletHours.add("ד");
						daletHours.add(daletValueFrom2);
						daletHours.add(daletValueTo2);
						weekHours.add(daletHours);
					}
					
					
					if (hey.isSelected())
					{
						String heyValueFrom = (String)heyFrom.getModel().getValue();
						String heyValueFrom1=heyValueFrom.substring(0,2);
						String heyValueFrom2;			
						if(heyValueFrom1.endsWith("."))
							heyValueFrom2=heyValueFrom.substring(0,1);
						else heyValueFrom2=heyValueFrom1;

						String heyValueTo = (String)heyTo.getModel().getValue();
						String heyValueTo1=heyValueTo.substring(0,2);
						String heyValueTo2;			
						if(heyValueTo1.endsWith("."))
							heyValueTo2=heyValueTo.substring(0,1);
						else heyValueTo2=heyValueTo1;
						
						Vector<String> heyHours=new Vector<String>();
						heyHours.add("ה");
						heyHours.add(heyValueFrom2);
						heyHours.add(heyValueTo2);
						weekHours.add(heyHours);
								
					}
					
					if (vav.isSelected())
					{
						String vavValueFrom = (String)vavFrom.getModel().getValue();
						String vavValueFrom1=vavValueFrom.substring(0,2);
						String vavValueFrom2;			
						if(vavValueFrom1.endsWith("."))
							vavValueFrom2=vavValueFrom.substring(0,1);
						else vavValueFrom2=vavValueFrom1;

						String vavValueTo = (String)vavTo.getModel().getValue();
						String vavValueTo1=vavValueTo.substring(0,2);
						String vavValueTo2;			
						if(vavValueTo1.endsWith("."))
							vavValueTo2=vavValueTo.substring(0,1);
						else vavValueTo2=vavValueTo1;
						
						Vector<String> vavHours=new Vector<String>();
						vavHours.add("ו");
						vavHours.add(vavValueFrom2);
						vavHours.add(vavValueTo2);
						weekHours.add(vavHours);
					}
					
					
					if (shabat.isSelected())
					{
						String shabatValueFrom = (String)shabatFrom.getModel().getValue();
						String shabatValueFrom1=shabatValueFrom.substring(0,2);
						String shabatValueFrom2;			
						if(shabatValueFrom1.endsWith("."))
							shabatValueFrom2=shabatValueFrom.substring(0,1);
						else shabatValueFrom2=shabatValueFrom1;

						String shabatValueTo = (String)shabatTo.getModel().getValue();
						String shabatValueTo1=shabatValueTo.substring(0,2);
						String shabatValueTo2;			
						if(shabatValueTo1.endsWith("."))
							shabatValueTo2=shabatValueTo.substring(0,1);
						else shabatValueTo2=shabatValueTo1;
						
						Vector<String> shabatHours=new Vector<String>();
						shabatHours.add("שבת");
						shabatHours.add(shabatValueFrom2);
						shabatHours.add(shabatValueTo2);
						weekHours.add(shabatHours);
												
					}
					
					employee.setWeekHours(weekHours);
					
					int n = JOptionPane.showConfirmDialog(
						    null,
						    "הנתונים הקןדמים יימחקו מהמערכת. האם ברצונך להמשיך?",
						    "עדכון פרטי עובד",
						    JOptionPane.YES_NO_OPTION);
					 //Object selectedValue = pane.getValue();
					 if(n==1){
						
						 
					 }
					 else{
						
					
					MessageUpdateEmployee msgUpdEmp=new MessageUpdateEmployee(employee);
					
					
						try {
							mainMenu.ms.client.sendToServer(msgUpdEmp);
							MessageSavingReply result=(MessageSavingReply)mainMenu.ms.client.GetMessage();
							
							if (result.getResult()==1) 
							{
							JLabel goodLbl2=new JLabel("הנתונים נשמרו בהצלחה");
							goodLbl2.setFont(new Font("Tahoma", Font.BOLD, 11));
							goodLbl2.setForeground(Color.blue);
							check_panel.add(goodLbl2);
							}
							else
							{
								JLabel wrongLbl2=new JLabel("בעיית תקשורת.הנתונים לא נשמרו");
								wrongLbl2.setFont(new Font("Tahoma", Font.BOLD, 15));
								wrongLbl2.setForeground(Color.red);
								check_panel.add(wrongLbl2);
							}
						} catch (IOException e1) {
							e1.printStackTrace();
						}
						
					 }  //if (n==1) {...} else
					
						
				}
				
				else  //wrong input-print all errors on check_panel
				{
					JLabel wrongLbl=new JLabel("תהליך עדכון פרטי העובד נכשל :");
					wrongLbl.setFont(new Font("Tahoma", Font.BOLD, 13));
					wrongLbl.setForeground(Color.red);
					check_panel.add(wrongLbl);
					for(int i=0;i<size;i++)
					{
						JLabel error=new JLabel(checkingResult.get(i));
						error.setForeground(Color.red);
						check_panel.add(error);
					}
				}
				
				
				
				mainMenu.getContentPane().validate();
			}
		});
		
	return btnSave;	
	}
	
	private JSpinner createHoursSpinner ()
	{
		String[] hoursStrings =new ConstantObjects().getWorkHours(); 
		SpinnerListModel hoursModel = new SpinnerListModel(hoursStrings);
		JSpinner spinner = new JSpinner(hoursModel); 
		return spinner;
	}
	
	private void set_Visible_False_For_Working_Panel()
	{
		alefFrom.setVisible(false);
	    betFrom.setVisible(false);
		gimelFrom.setVisible(false);
		daletFrom.setVisible(false);
		heyFrom.setVisible(false);
		vavFrom.setVisible(false);
		shabatFrom.setVisible(false);
		alefTo.setVisible(false);
		betTo.setVisible(false);
		gimelTo.setVisible(false);
		daletTo.setVisible(false);
	    heyTo.setVisible(false);
		vavTo.setVisible(false);
		shabatTo.setVisible(false);
		
		alefFromlbl.setVisible(false);
		betFromlbl.setVisible(false);
		gimelFromlbl.setVisible(false);
		daletFromlbl.setVisible(false);
		heyFromlbl.setVisible(false);
		vavFromlbl.setVisible(false);
		shabatFromlbl.setVisible(false);
		alefTolbl.setVisible(false);
		betTolbl.setVisible(false);
		gimelTolbl.setVisible(false);
	    daletTolbl.setVisible(false);
		heyTolbl.setVisible(false);
		vavTolbl.setVisible(false);
		shabatTolbl.setVisible(false);
	}
	
	 private Vector <String> inputCheck()
	 {
		 Vector<String> result=new Vector<String>();
		 
		 
		//==================================================check for id===============================		 
		 String id = textField_id_number.getText();
	      if (id.length() != 0) 
	      {
	          for(int i=0; i<id.length();i++)
	        	  if (id.charAt(i)<'0'|| id.charAt(i)>'9')
		    		 {
		    			 result.add("מספר תעודת זהות שגוי.יש להקיש ספרות בלבד");
		    			 break;
		    		 }	    
		      }
	      else 
	      {
	    	  result.add("יש להקיש תעודת זהות");	
	      }
		 
//=================================================check for name================================
	      
	     String name=textField_name.getText();
	     if(name.length()==0) result.add("יש להקיש שם פרטי");
	     else
	     {
	    	 for(int i=0;i<name.length();i++)
	    	 {
	    		 if ((name.charAt(i)<'א'|| name.charAt(i)>'ת')&&name.charAt(i)!=' ')
	    		 {
	    			 result.add("שם פרטי אינו תקין");
	    			 break;
	    		 }	    		 
	    	 }
	     }
	     
	     
//================================================check for last name ============================
	     
	     
	     String surName=textField_surName.getText();
	     if(surName.length()==0) result.add("יש להקיש שם משפחה");
	     else
	     {
	    	 for(int i=0;i<surName.length();i++)
	    	 {
	    		 if ((surName.charAt(i)<'א'|| surName.charAt(i)>'ת')&&surName.charAt(i)!=' ')
	    		 {
	    			 result.add("שם משפחה אינו תקין");
	    			 break;
	    		 }	    		 
	    	 }
	     }
	     
	     
	     
	     
//=============================================check for city ======================
	     
	     String city=textField_city.getText();
	     if(city.length()==0) result.add("יש להקיש עיר");
	     else
	     {
	    	 for(int i=0;i<city.length();i++)
	    	 {
	    		 if ((city.charAt(i)<'א'|| city.charAt(i)>'ת')&&city.charAt(i)!=' ')
	    		 {
	    			 result.add("עיר אינה תקינה");
	    			 break;
	    		 }	    		 
	    	 }
	     }
	 
	     
//============================================check for telephone======================	 
	     
	     String tel = textField_phoneNo.getText();
	     if (tel.length() != 0) 
	      {
	    	  if(tel.length()<9 || tel.length()>10) result.add("מספר טלפון שגוי");
	          for(int i=0; i<tel.length();i++)
	        	  if (tel.charAt(i)<'0'|| tel.charAt(i)>'9' )
		    		 {
		    			 result.add("מספר טלפון שגוי.יש להקיש ספרות בלבד");
		    			 break;
		    		 }	    
		      }
	      else 
	      {
	    	  result.add("יש להקיש מספר טלפון");	
	      }
	     
//============================================check for bank name======================	 
	     
	      String bankName=textField_nameBank.getText();
		    
		    	 for(int i=0;i<bankName.length();i++)
		    	 {
		    		 if (bankName.charAt(i)<'א'|| bankName.charAt(i)>'ת')
		    		 {
		    			 result.add("שם הבנק אינו תקין");
		    			 break;
		    		 }	    		 
		    	 }
		     
//==============================================check for branch number=================
		    	 String branch = textField_numBranch.getText();
			    
			    	 if(branch.length()!=0)
			          for(int i=0; i<branch.length();i++)
			        	  if (branch.charAt(i)<'0'|| branch.charAt(i)>'9')
				    		 {
				    			 result.add("מספר סניף שגוי.יש להקיש ספרות בלבד");
				    			 break;
				    		 }	    
				  
			      
//=============================================check for account number=====================			      	 
			        String account = textField_numAccount.getText(); 
				      
			        if(account.length()!=0)
			        for(int i=0; i<account.length();i++)
			        	  if (account.charAt(i)<'0'|| account.charAt(i)>'9')
				    		 {
				    			 result.add("מספר חשבון שגוי.יש להקיש ספרות בלבד");
				    			 break;
				    		 }	 
			        

			        
			        
//========================================check for password ======================================
			        if((String)priorityCB.getSelectedItem()!="0")
			        {
			        String password= textField_password.getText();
			        if(password.length()==0)
			        {
			        	result.add("יש להקיש סיסמה");
			        }
			        }
			        	
			        
//=======================================select for work week hours================================
		
	
		if (alef.isSelected())
		{
			String alefValueFrom = (String)alefFrom.getModel().getValue();
			String alefValueFrom1=alefValueFrom.substring(0,2);
			String alefValueFrom2;			
			if(alefValueFrom1.endsWith("."))
				alefValueFrom2=alefValueFrom.substring(0,1);
			else alefValueFrom2=alefValueFrom1;
			int alefFrom=Integer.parseInt(alefValueFrom2);

			String alefValueTo = (String)alefTo.getModel().getValue();
			String alefValueTo1=alefValueTo.substring(0,2);
			String alefValueTo2;			
			if(alefValueTo1.endsWith("."))
				alefValueTo2=alefValueTo.substring(0,1);
			else alefValueTo2=alefValueTo1;
			int alefTo=Integer.parseInt(alefValueTo2);
			
			if (alefFrom>=alefTo) result.add("שעות העבודה אינן תקינות ביום א");						
		}
		
	
		if (bet.isSelected())
		{
			String betValueFrom = (String)betFrom.getModel().getValue();
			String betValueFrom1=betValueFrom.substring(0,2);
			String betValueFrom2;			
			if(betValueFrom1.endsWith("."))
				betValueFrom2=betValueFrom.substring(0,1);
			else betValueFrom2=betValueFrom1;
			int betFrom=Integer.parseInt(betValueFrom2);

			String betValueTo = (String)betTo.getModel().getValue();
			String betValueTo1=betValueTo.substring(0,2);
			String betValueTo2;			
			if(betValueTo1.endsWith("."))
				betValueTo2=betValueTo.substring(0,1);
			else betValueTo2=betValueTo1;
			int betTo=Integer.parseInt(betValueTo2);
			
			if (betFrom>=betTo) result.add("שעות העבודה אינן תקינות ביום ב");						
		}
		
		if (gimel.isSelected())
		{
			String gimelValueFrom = (String)gimelFrom.getModel().getValue();
			String gimelValueFrom1=gimelValueFrom.substring(0,2);
			String gimelValueFrom2;			
			if(gimelValueFrom1.endsWith("."))
				gimelValueFrom2=gimelValueFrom.substring(0,1);
			else gimelValueFrom2=gimelValueFrom1;
			int gimelFrom=Integer.parseInt(gimelValueFrom2);

			String gimelValueTo = (String)gimelTo.getModel().getValue();
			String gimelValueTo1=gimelValueTo.substring(0,2);
			String gimelValueTo2;			
			if(gimelValueTo1.endsWith("."))
				gimelValueTo2=gimelValueTo.substring(0,1);
			else gimelValueTo2=gimelValueTo1;
			int gimelTo=Integer.parseInt(gimelValueTo2);
			
			if (gimelFrom>=gimelTo) result.add("שעות העבודה אינן תקינות ביום ג");						
		}
		
		
		if (dalet.isSelected())
		{
			String daletValueFrom = (String)daletFrom.getModel().getValue();
			String daletValueFrom1=daletValueFrom.substring(0,2);
			String daletValueFrom2;			
			if(daletValueFrom1.endsWith("."))
				daletValueFrom2=daletValueFrom.substring(0,1);
			else daletValueFrom2=daletValueFrom1;
			int daletFrom=Integer.parseInt(daletValueFrom2);

			String daletValueTo = (String)daletTo.getModel().getValue();
			String daletValueTo1=daletValueTo.substring(0,2);
			String daletValueTo2;			
			if(daletValueTo1.endsWith("."))
				daletValueTo2=daletValueTo.substring(0,1);
			else daletValueTo2=daletValueTo1;
			int daletTo=Integer.parseInt(daletValueTo2);
			
			if (daletFrom>=daletTo) result.add("שעות העבודה אינן תקינות ביום ד");						
		}
		
		
		if (hey.isSelected())
		{
			String heyValueFrom = (String)heyFrom.getModel().getValue();
			String heyValueFrom1=heyValueFrom.substring(0,2);
			String heyValueFrom2;			
			if(heyValueFrom1.endsWith("."))
				heyValueFrom2=heyValueFrom.substring(0,1);
			else heyValueFrom2=heyValueFrom1;
			int heyFrom=Integer.parseInt(heyValueFrom2);

			String heyValueTo = (String)heyTo.getModel().getValue();
			String heyValueTo1=heyValueTo.substring(0,2);
			String heyValueTo2;			
			if(heyValueTo1.endsWith("."))
				heyValueTo2=heyValueTo.substring(0,1);
			else heyValueTo2=heyValueTo1;
			int heyTo=Integer.parseInt(heyValueTo2);
			
			if (heyFrom>=heyTo) result.add("שעות העבודה אינן תקינות ביום ה");						
		}
		
		if (vav.isSelected())
		{
			String vavValueFrom = (String)vavFrom.getModel().getValue();
			String vavValueFrom1=vavValueFrom.substring(0,2);
			String vavValueFrom2;			
			if(vavValueFrom1.endsWith("."))
				vavValueFrom2=vavValueFrom.substring(0,1);
			else vavValueFrom2=vavValueFrom1;
			int vavFrom=Integer.parseInt(vavValueFrom2);

			String vavValueTo = (String)vavTo.getModel().getValue();
			String vavValueTo1=vavValueTo.substring(0,2);
			String vavValueTo2;			
			if(vavValueTo1.endsWith("."))
				vavValueTo2=vavValueTo.substring(0,1);
			else vavValueTo2=vavValueTo1;
			int vavTo=Integer.parseInt(vavValueTo2);
			
			if (vavFrom>=vavTo) result.add("שעות העבודה אינן תקינות ביום ו");						
		}
		
		
		if (shabat.isSelected())
		{
			String shabatValueFrom = (String)shabatFrom.getModel().getValue();
			String shabatValueFrom1=shabatValueFrom.substring(0,2);
			String shabatValueFrom2;			
			if(shabatValueFrom1.endsWith("."))
				shabatValueFrom2=shabatValueFrom.substring(0,1);
			else shabatValueFrom2=shabatValueFrom1;
			int shabatFrom=Integer.parseInt(shabatValueFrom2);

			String shabatValueTo = (String)shabatTo.getModel().getValue();
			String shabatValueTo1=shabatValueTo.substring(0,2);
			String shabatValueTo2;			
			if(shabatValueTo1.endsWith("."))
				shabatValueTo2=shabatValueTo.substring(0,1);
			else shabatValueTo2=shabatValueTo1;
			int shabatTo=Integer.parseInt(shabatValueTo2);
			
			if (shabatFrom>=shabatTo) result.add("שעות העבודה אינן תקינות ביום שבת");						
		}
		       
	     
		 return result;
		 
	 }
	}